<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../libs/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../../libs/app.css" />
		<link rel="stylesheet" type="text/css" href="../../css/mui.listpicker.css" />
		<link rel="stylesheet" href="../../css/mui.poppicker.css" />
		<link href="../../css/main.css" rel="stylesheet" />
		<link href="../../css/askfor.css" rel="stylesheet" />
	</head>

	<body>
		<div class="head">
			<img class="mui-action-back" src="../../images/all-left.png" alt="">
			<p>申请信息</p>
		</div>
		<div class="context2">
			<div class="state">
				<div><span class="one">1</span>
					<p>服务商选择</p>
				</div>
				<div><span style="background-color: white;color: black;" class="two">2</span>
					<p>申请人信息</p>
				</div>
				<div><span class="three">3</span>
					<p>申请结果</p>
				</div>
				<img class="gang1" src="../../images/white-gang.png" alt="">
				<img class="gang2" src="../../images/white-gang.png" alt="">
			</div>
			<div class="message">
				<div>
					<p>姓名</p>
					<input class="name" type="text" placeholder="请输入姓名">
				</div>
				<div>
					<p>身份证号</p>
					<input class="card" type="text" placeholder="请输入身份证号">
				</div>
				<div>
					<p>职业信息</p>
					<select id="wordinfo">
						<option value="">请选择</option>
						<option value="医生">医生</option>
						<option value="教师">教师</option>
						<option value="公务员">公务员</option>
						<option value="企业主">企业主</option>
						<option value="个体户">个体户</option>
						<option value="上班族">上班族</option>
						<option value="事业单位">事业单位</option>
						<option value="自雇人士">自雇人士</option>
					</select>
				</div>
				<div>
					<p>税前收入</p><span>万元</span>
					<input class="income" type="text" placeholder="请输入月收入">
				</div>
				<div>
					<p>贷款金额</p><span>万元</span>
					<input class="price" type="text" placeholder="请输入借款金额">
				</div>
				<div>
					<p>贷款期限</p>
					<select id="date">
						<option value="">请选择</option>
						<option value="6期">6期</option>
						<option value="12期">12期</option>
						<option value="24期">24期</option>
						<option value="36期">36期</option>
					</select>
				</div>
				<div>
					<p>信用状况</p>
					<select id="credit">
						<option value="">请选择</option>
						<option value="一年内逾期超过3次或超过90天" title="一年内逾期超过3次或超过90天">一年内逾期超过3次或超过90天</option>
						<option value="一年内逾期少于3次或少于90天" title="一年内逾期少于3次或少于90天">一年内逾期少于3次或少于90天</option>
						<option value="无信用卡或无贷款" title="无信用卡或无贷款">无信用卡或无贷款</option>
						<option value="信用良好，无逾期" title="信用良好，无逾期">信用良好，无逾期</option>
					</select>
					<!--<input class="credit" type="text" placeholder="请输入信用情况">-->
				</div>

				<div class="select">
					<p>名下是否有车</p>
					<select class="haveCar">
						<option value="是">是</option>
						<option value="否">否</option>
					</select>
				</div>

				<div>
					<p>名下是否有房产</p>
					<select class="haveHouse">
						<option value="是">是</option>
						<option value="否">否</option>
					</select>
				</div>

				<div id='showCityPicker3' class="mui-btn mui-btn-block">
					<p>申请地点</p>
					<i class="icon-editCity"></i>
					<input readonly="true" id='cityResult3' class="ui-alert area" placeholder="请选择"  type="text"/>
				</div>
				<!--<div>
                <p>所需服务</p>
                <input class="freeService" type="text" placeholder="请输入所需服务" >
            </div>-->

			</div>
			<!--<div class="yan">
				<div class="yan-input"><input type="text" placeholder=""></div>
				<div><button>获取验证码</button></div>
				<img src="../../images/yan.png" alt="">
			</div>-->
			<div class="button">
				<button id="askfor3">下一步</button>
			</div>
		</div>

		<script src="../../js/jquery-3.1.1.min.js"></script>
		<script src="../../libs/mui.min.js"></script>
		<script src="../../js/url.js"></script>
		<script src="../../js/city-data-3.js"></script>
		<script src="../../js/mui.listpicker.js"></script>
		<script src="../../js/mui.poppicker.js"></script>
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=AIEts6CoFGpdivbIz3uI3SrAG9iDB0Ko"></script>
		<script src="../../js/location.js"></script>
		<script src="../../js/city-public.js"></script>
		<script>
			var token = localStorage.token;
			//接口

			$('#askfor3').on('tap', function() {
				var name = $('.name').val();
				var id_card = $('.id_card').val();
				var work = $('#wordinfo').val();
				var income = $('.income').val();
				var price = $('.price').val();
				var date = $('#date').val();
				var credit = $('#credit').val();

				var haveCar = $('.haveCar').val();
				var haveHouse = $('.haveHouse').val();
				var area = $('.area').val();
				var hanzi = /^[\u4e00-\u9fa5]*$/;
				var sfzh = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
				var shouru = /^[0-9]+(.[0-9]{3})?$/;
				if(name == '') {
					mui.toast('请输检查您的姓名');
					return;
				} else if(card == '') {
					mui.toast('请输检查您的身份证号');
					return;
				} else if((!shouru.test(income)) || income == '') {
					mui.toast('请输检查您的月收入');
					return;
				} else if((!shouru.test(price)) || price == '') {
					mui.toast('请输检查您的借款金额');
					return;
				} else if(work == '' || date == '' || credit == '' || area == '') {
					mui.toast('请检查您输入的信息');
					return;
				} else {
					if(localStorage.dk_type == 2) {
						b();
					} else {
						a();
					}
				}

				function a() {
					$.ajax({
						url: ur + 'rest/loanController/request',
						type: "post",
						dataType: "json",
						headers: {
							"X-Token": token
						},
						data: {
							loanCode: 'xyd',
							evaluateId:localStorage.evaluateId,
                            point: (localStorage.locationPoint ? localStorage.locationPoint : ''), // 坐标
							params: "[{name:'" + name + "',id_card:'" + id_card + "',work:'" + work + "',income:'" + income + "',price:'" + price + "',date:'" + date + "',credit:'" + credit +
								"',haveCar:'" + haveCar + "',haveHouse:'" + haveHouse + "',area:'" + area + "',freeService:'银行'" + "}]"
						},
						success: function(data) {
							if(data.meta.code == 'S002') {
								href('askfor3.html', 'askfor3');
							}
						}

					})

				}
				// 快速贷款
				function b() {
					$.ajax({
						url: ur + 'rest/quickLoanController/quick-request',
						type: "post",
						dataType: "json",
						headers: {
							"X-Token": token
						},
						data: {
							loanCode: 'qcdy',
							partnerId: localStorage.fast_partner,
							quickId: localStorage.fast_id,
							evaluateId:localStorage.evaluateId,
							params: "[{name:'" + name + "',id_card:'" + id_card + "',work:'" + work + "',income:'" + income + "',price:'" + price + "',date:'" + date + "',credit:'" + credit +
								"',haveCar:'" + haveCar + "',haveHouse:'" + haveHouse + "',area:'" + area + "',freeService:'银行'" + "}]"
						},
						success: function(data) {
							if(data.meta.code == 'S002') {
								href('askfor3.html', 'askfor3');
							}
						}
					})
				}
			})
		</script>
	</body>

</html>